package com.dianping.cat.home.storage.alert.entity;

import com.dianping.cat.home.storage.alert.BaseEntity;
import com.dianping.cat.home.storage.alert.IVisitor;
import java.util.LinkedHashMap;
import java.util.Map;






public class Storage
  extends BaseEntity<Storage>
{
  private String m_id;
  private int m_level;
  private int m_count;
/*  19 */   private Map<String, Machine> m_machines = new LinkedHashMap();





  public Storage(String id) { this.m_id = id; }




/*  30 */   public void accept(IVisitor visitor) { visitor.visitStorage(this); }


  public Storage addMachine(Machine machine) {
/*  34 */     this.m_machines.put(machine.getId(), machine);
/*  35 */     return this;
  }


  public boolean equals(Object obj) {
/*  40 */     if (obj instanceof Storage) {
/*  41 */       Storage _o = (Storage)obj;

/*  43 */       if (!equals(getId(), _o.getId())) {
/*  44 */         return false;
      }

/*  47 */       return true;
    }

/*  50 */     return false;
  }


/*  54 */   public Machine findMachine(String id) { return (Machine)this.m_machines.get(id); }


  public Machine findOrCreateMachine(String id) {
/*  58 */     Machine machine = (Machine)this.m_machines.get(id);

/*  60 */     if (machine == null) {
/*  61 */       synchronized (this.m_machines) {
/*  62 */         machine = (Machine)this.m_machines.get(id);

/*  64 */         if (machine == null) {
/*  65 */           machine = new Machine(id);
/*  66 */           this.m_machines.put(id, machine);
        }
      }
    }

/*  71 */     return machine;
  }


/*  75 */   public int getCount() { return this.m_count; }



/*  79 */   public String getId() { return this.m_id; }



/*  83 */   public int getLevel() { return this.m_level; }



/*  87 */   public Map<String, Machine> getMachines() { return this.m_machines; }



  public int hashCode() {
/*  92 */     int hash = 0;

/*  94 */     return hash * 31 + ((this.m_id == null) ? 0 : this.m_id.hashCode());
  }



  public Storage incCount() {
/* 100 */     this.m_count++;
/* 101 */     return this;
  }

  public Storage incCount(int count) {
/* 105 */     this.m_count += count;
/* 106 */     return this;
  }


  public void mergeAttributes(Storage other) {
/* 111 */     assertAttributeEquals(other, "storage", "id", this.m_id, other.getId());

/* 113 */     this.m_level = other.getLevel();

/* 115 */     this.m_count = other.getCount();
  }


/* 119 */   public Machine removeMachine(String id) { return (Machine)this.m_machines.remove(id); }


  public Storage setCount(int count) {
/* 123 */     this.m_count = count;
/* 124 */     return this;
  }

  public Storage setId(String id) {
/* 128 */     this.m_id = id;
/* 129 */     return this;
  }

  public Storage setLevel(int level) {
/* 133 */     this.m_level = level;
/* 134 */     return this;
  }

  public Storage() {}
}


/* Location:              /Users/hanfei/Documents/apache-tomcat-9.0.24/webapps/cat/WEB-INF/classes/!/com/dianping/cat/home/storage/alert/entity/Storage.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       1.0.7
 */